package com.controller.student;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.po.Student;
import com.service.student.StestService;

@Controller
public class StestController {
	
	@Resource(name="stestServiceImp")
	private StestService stuservice;
	
	@ResponseBody
	@RequestMapping(value="/find")
	public Student findStudent(@RequestBody Student student){
		
		System.out.println(student);
		Student stu = stuservice.findStudent(student);
		return stu;
	}
	
	@ResponseBody
	@RequestMapping(value="/add")
	public int addStudent(@RequestBody Student student){
		
		return stuservice.addStudent(student);
	}
	
	@ResponseBody
	@RequestMapping(value="/getList")
	public List<Student> getStuList(){
		
		return (List<Student>)stuservice.getStuList();
	}
	
	@ResponseBody
	@RequestMapping(value="/del")
	public int delStudent(@RequestParam("stuid") String stuid){
		
		System.out.println("stuid**************"+stuid);
		return stuservice.delStudent(stuid);
	}
	
	@ResponseBody
	@RequestMapping(value="/update")
	public int updateStudent(@RequestBody Student student){
		
		return stuservice.updateStudent(student);
	}
}
